<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>

<head>
  <meta charset="UTF-8">
  <title>随手拍留言板</title>
  <meta name="page-view-size" content="1280*720">
  <link rel="stylesheet" href="../css/base.css">
  <link rel="stylesheet" href="../css/common.css">
  <link rel="stylesheet" href="../css/interactive.css">
  <script type="text/javascript" src="../lib/js/evm.js"></script>
  <script type="text/javascript" src="../lib/js/Evm_djyw.js"></script>
  <script type="text/javascript" src="../lib/js/key.js"></script>
  <script src="../lib/js/jquery-1.11.1.min.js" type="text/javascript" charset="utf-8"></script>
  <script src="../lib/js/jquery.cookie.js" type="text/javascript" charset="utf-8"></script>
  <script src="../js/api.js" type="text/javascript" charset="utf-8"></script>
  <script src="../js/public.js" type="text/javascript" charset="utf-8"></script>
  <script src="../js/model.js"></script>
  <style>
    .list-photo.active {
      background: #FBC000;
      margin-top: 20px;
      height: 392px;
    }

    .list-photo.active .list-title {
      height: auto;
      top: 234px;
    }

    .list-photo.active p {
      height: auto;
      -webkit-line-clamp: 3;
    }
  </style>
</head>

<body>
  <div class="volunteer-bg" id="volunteerMain">
    <ul class="nav-bg" id="nav-bg">
    </ul>

    <!-- 下左侧模块 -->
    <ul id="menu_bg" class="menu-bg">



    </ul>


    <div class="list-bg">
      <div class="list-con" id="list-con">

      </div>

      <p class="page-show" id="page_show"><span id="now_page">0</span>/<span id="total_page">0</span>

      </p>
    </div>

  </div>

  </div>

</body>
<script>

  var leftData = leftModel[TV.GetParam("model")].arry;

  var modelIndex = {
    index: 0, //导航栏初始位置
    menuKey: '',
    menuPageSize: 5, //导航栏模块数量
    pageSize: 1, //主模块数量
    type: '',
    crumbs:leftModel[TV.GetParam("model")].name ,
    structure: 2, //上下结构  默认1是左右，2是上下结构
    menuContainerId: 'nav-bg', //包含导航栏模块的标签id
    menuListName: 'nav', //导航栏模块名称class
    mainContainerId: 'list-con', //包含主模块的标签id
    mainlistName: '', //主模块名称
    model_api: '', //当前模块的api路径
    model_detail: '', //当前模块去往的页面
    id: 'interactive',
  }

  function getMenus(page, number) {
    if (typeof number == 'number') {
      // modelIndex.mainContainerId = leftData[number].list_name;
    }
    left.paint(page, number);
    $(".nav").css("width",(1/leftData.length)*100+"%")


  }

  function getMessage(id, page, pos, index) { //id,类型，页码，上下页，位置
    console.log(id, page, pos, index, modelIndex.menuKey)
    var params = {
      // cid: id,
      page: page,
      pagesize: modelIndex.pageSize,
      // month: modelIndex.menuKey || ''
      // area_id: $.cookie('TV_CST_AREA')
    }

    if (id == '3') {
      var params = {
        // status:0,
        page: page,
        pagesize: modelIndex.pageSize,
        // month: modelIndex.menuKey || ''
        // area_id: $.cookie('TV_CST_AREA')
      }
      GetDatas(modelIndex.model_api, params, function (res, data) {
        var mess = data.data;
        console.log(mess.items)
        var str = '';
        if (mess.items.length) {
          for (var i = 0; i < mess.items.length; i++) {
            $('#page_show').css('display', 'block');
            str += '<div class="' + modelIndex.mainlistName + '" data-id=' + mess.items[i].id +
              " data-tpe=" + mess.items[i].tpe + " >";
            if (modelIndex.mainlistName == 'list-row') {
              str += '<div class="list-info">'
              //图片                      
              var img = '';
              if (!mess.items[i].images) {
                img = '../images/base.png'
              } else {
                img = API_URL.imgURL + mess.items[i].images
              }
              str += '<div class="list-imgBar">'
              str += "<img class='list-img' src=" + img + ">";
              str += '</div>'
              //标题
              str += "<div class='list-title'><p class='ell'>" + mess.items[i].title + "</p></div>";
              //简介 时间
              str += "<div class='list-address'>" + mess.items[i].address + "</div>"
              str += "<div class='list-start-time'>" + mess.items[i].format_add_time + "</div>"
              //info结束
              str += '</div>'

              //活动状态
              str += '<div class="list-status">'
              if (mess.items[i].status == 3) {
                str += '<img src="../images/icon-2.png">'
              } else if (mess.items[i].status == 2) {
                str += '<img src="../images/icon-1.png">'
              } else {
                str += '<img src="../images/icon-0.png">'
              }
              str += '</div>'

              str += '</div>'
            } else if (modelIndex.mainlistName == 'list-video') {
              var img = '';
              if (mess.items[i].images == '') {
                img = '../images/base.png'
              } else {
                img = API_URL.imgURL + mess.items[i].images
              }
              str += '<div class="list-imgBar">'
              str += "<img class='list-img' src=" + img + ">";
              str += '</div>'
              if (mess.items[i].tpe == 5 || mess.items[i].tpe == 4) {
                str += "<div class='listPlay' ><img src='../images/play.png'></div>";
              }
              str += "<div class='list-title'><p class='ell'>" + mess.items[i].title + '</p></div>'
              str += '</div>'
            }
          }
        } else {
          str = '<h1>暂无数据</h1>'
          $('.page-show').css('display', 'none')
        }
        $('#now_page').html(page)
        $('#total_page').html(mess.totalpage)
        $('#' + modelIndex.mainContainerId).html(str);
        MessOpt(page, mess.totalpage, pos, index);
      })
    }else if (id == '999') {
      var params = {
        // status:0,
        tpe: 2,
        page: page,
        pagesize: modelIndex.pageSize,
        // month: modelIndex.menuKey || ''
        // area_id: $.cookie('TV_CST_AREA')
      }
      GetDatas(modelIndex.model_api, params, function (res, data) {
        var mess = data.data;
        console.log(mess.items)
        var str = '';
        if (mess.items.length) {
          for (var i = 0; i < mess.items.length; i++) {
            $('#page_show').css('display', 'block');
            str += '<div class="' + modelIndex.mainlistName + '" data-id=' + mess.items[i].id +
              " data-tpe=" + mess.items[i].tpe + " >";
            if (modelIndex.mainlistName == 'list-photo') {
              //图片                      
              var img = '';
              if (!mess.items[i].img) {
                img = '../images/base.png'
              } else {
                img = API_URL.imgURL + mess.items[i].img
              }
              str += '<div class="list-imgBar">'
              str += "<img class='list-img' src=" + img + " onerror=javascript:this.src='../images/base.png'>";
              str += '</div>'
              //标题
              str += "<div class='list-title'><p>" + mess.items[i].title + "</p></div>";
              //简介 时间
              str += "<div class='list-uploader'>" + mess.items[i].username + "</div>"
              str += "<div class='list-time'>" + mess.items[i].addtime + "</div>"

              str += '</div>'
            }
          }
        } else {
          str = '<h1>暂无数据</h1>'
          $('.page-show').css('display', 'none')
        }
        $('#now_page').html(page)
        $('#total_page').html(mess.totalpage)
        $('#' + modelIndex.mainContainerId).html(str);
        MessOpt(page, mess.totalpage, pos, index);
      })
    }
    else if (id == '2222') {
      var params = {
        pageSize: 7
      }
      GetDatas(modelIndex.model_api, params, function (err, res) {
        var str = '';
        res = {
          status: 200,
          exception: "",
          code: 0,
          message: "",
          data: {
            items: [
              {
                content: "<span class='helper'>君以自牧</span>帮助了<span class='appeal'>陈在</span>得到评分<span class='score'>5</sapn>分"
              },
              {
                content: "<span class='helper'>船上人家</span>帮助了<span class='appeal'>树平</span>得到评分<span class='score'>0</sapn>分"
              },
              {
                content: "<span class='helper'>船上人家</span>帮助了<span class='appeal'>树平</span>"
              },
              {
                content: "<span class='helper'>君以自牧</span>帮助了<span class='appeal'>让人</span>"
              },
              {
                content: "<span class='helper'>君以自牧</span>帮助了<span class='appeal'>陈在</span>"
              }
            ],
            pagesize: 10,
            curpage: 1,
            totalpage: 1,
            total: 5
          }
        }
        var mess = res.data;
        // console.log(mess)
        if (mess.items && mess.items.length) {
          str += '<marquee id="marquee" direction="up" scrollamount="5">'
          for (var i = 0; i < mess.items.length; i++) {
            str += "<div class='ruleTitle'>" + mess.items[i].content + "</div>"
          }
          str += '</marquee>'
        } else {
          str += '<h1>暂无数据</h1>'
        }
        str += '<div class="list-button" >我要求助</div>'
        str += '<div class="list-qrcode" ><img src="../images/for-help.png"></div>'
        // str += "<div class='ruleTitle'>" + res.data.title + "</div>"
        // str += "<div  class='ruleContent'>11</div>"
        $('#' + modelIndex.mainContainerId).html(str);
        $('.page-show').css('display', 'none')
        MessOpt(1, 1, pos, index);
      })
    }
  }
  function direEnter(status, id, index) {
    if (id == '2222') {
      var access_token = $.cookie('TV_CST_TOKEN');
      var param = {
        cardNo: 234,
        access_token: access_token,
      }
      GetDatas('appeal', param, function (err, res) {
        console.log(res)
        if (res.code == 0) {
          TV.PromptMsg('求助成功')
          $(".cur-number").eq(index).html(res.data.likes);
          // $('#like').css('background-image','url(../images/like-2.png)')
        } else if (res.code == 401) {

          TV.userLogin();
          direEnter(index);
          // alert('111')
        } else {
          var message = res.message
          TV.PromptMsg(message)
        }
      })
    }else{
      window.location.href = modelIndex.model_detail+".html?id=" + $('.active').attr('data-id');

    }
  }


</script>
<script type="text/javascript" src="../js/twoPageList-1.js"></script>

</html>